<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%proxy_pay}}".
 *
 * @property int $id
 * @property int $created_at
 * @property string $company_code
 * @property string $unique_id
 * @property int $status
 * @property string $orderno
 * @property string $branchnm
 * @property string $accntno
 * @property string $accntnm
 * @property int $amount
 * @property string $other_data
 * @property string $post_data
 * @property string $resp_data
 *
 * @property ProxyPayBack[] $proxyPayBacks
 */
class ProxyPay extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%proxy_pay}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['created_at', 'company_code', 'unique_id', 'orderno', 'branchnm', 'accntno', 'accntnm', 'amount'], 'required'],
            [['created_at', 'status', 'amount'], 'integer'],
            [['other_data', 'post_data', 'resp_data'], 'string'],
            [['company_code', 'unique_id', 'orderno', 'accntnm'], 'string', 'max' => 20],
            [['branchnm'], 'string', 'max' => 50],
            [['accntno'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'company_code' => Yii::t('app', 'Company Code'),
            'unique_id' => Yii::t('app', 'Unique ID'),
            'status' => Yii::t('app', 'Status'),
            'orderno' => Yii::t('app', 'Orderno'),
            'branchnm' => Yii::t('app', 'Branchnm'),
            'accntno' => Yii::t('app', 'Accntno'),
            'accntnm' => Yii::t('app', 'Accntnm'),
            'amount' => Yii::t('app', 'Amount'),
            'other_data' => Yii::t('app', 'Other Data'),
            'post_data' => Yii::t('app', 'Post Data'),
            'resp_data' => Yii::t('app', 'Resp Data'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getProxyPayBacks()
    {
        return $this->hasMany(ProxyPayBack::className(), ['proxy_pay_id' => 'id']);
    }
}
